﻿package net.wangit.demo.unit;

import net.wangit.MapList;
import net.wangit.Unit;
import net.wangit.context.ActionContext;
import net.wangit.support.UnitInterceptor;
import net.wangit.util.RandomUtil;

public class SampleDataUI implements UnitInterceptor {

  public String intercept(ActionContext ac, Unit unit) throws Exception {
    MapList data = new MapList();
    for (int i = 0; i < 5; i++) {
      data.put(i, "a", RandomUtil.getRandomString(10));
      data.put(i, "b", RandomUtil.getRandomString(10));
      data.put(i, "c", RandomUtil.getRandomString(10));
      data.put(i, "d", RandomUtil.getRandomString(10));
    }
    unit.setData(data);
    return unit.write(ac);
  }

}
